import 'package:xws/helpers/as_t.dart';

/// 轮播图对象
class BannerObj {
  const BannerObj({
    required this.id,
    required this.imgUrl,
    required this.name,
    required this.redirectUrl,
    required this.sort,
  });

  factory BannerObj.fromJson(Map<String, dynamic> jsonRes) => BannerObj(
        id: asT<String>(jsonRes['id']),
        imgUrl: asT<String>(jsonRes['imgUrl']),
        name: asT<String>(jsonRes['name']),
        redirectUrl: asT<String>(jsonRes['redirectUrl']),
        sort: asT<int>(jsonRes['sort']),
      );

  final String id;
  final String imgUrl;
  final String name;
  final String redirectUrl;
  final int sort;
}
